package com.sojson.controller.po.param.verify;

import com.sojson.entity.po.CouponStore;
import com.sojson.result.Result;
import com.sojson.util.StringUtil;

/**
 * CouponStore参数验证
 * 
 * @author liu
 * @date 2021-03-16
 */
public class CouponStoreParamVerify {

    /**
     * 单条插入
     * 
     * @param couponStore
     * @return
     */
    public static Result<Integer> insert(CouponStore couponStore) {
        if (StringUtil.isBlank(couponStore.getCouponNo())) {
            return Result.fail("优惠券编号不能为空！");
        }
        if (StringUtil.isBlank(couponStore.getStoreNo())) {
            return Result.fail("店铺编号不能为空！");
        }

        return Result.success();
    }

    /**
     * 通过id更新(局部更新)
     * 
     * @param couponStore
     * @return
     */
    public static Result<Integer> updateById(CouponStore couponStore) {
        if (StringUtil.isBlank(couponStore.getId())) {
            return Result.fail("ID不能为空！");
        }

        return Result.success();
    }

}